home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / seventh.wrl < prev    next >
Text File  |  1995-06-13  |  1KB  |  65 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example seven -create the Moon as a child of the Earth
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     Sphere {
  17.         radius 10        # Big Sun
  18.     }
  19.  
  20.     # We place the Earth within it's own Separator
  21.     # To keep everything good and isolated
  22.     Separator {
  23.  
  24.         # Let's move things out of the way here
  25.         Transform {
  26.             translation 0 20 20
  27.         }
  28.  
  29.         # Color the Earth blue, and make it absorb light
  30.         # But also make it a reflective, like water
  31.         Material {
  32.             diffuseColor 0 0 1 # Big blue marble
  33.             shininess 0.9 # Water is rather shiny
  34.         }
  35.  
  36.         # Finally, create the earth
  37.         Sphere {
  38.             radius 2    # Little Earth
  39.         }
  40.  
  41.         # The Moon gets its own Separator
  42.         # Because we really do keep everything separate
  43.         Separator {
  44.  
  45.             # The Moon is just outside the Earth
  46.             Transform {
  47.                 translation 4 4 0
  48.             }
  49.  
  50.             # Color the Moon grey, make it absorb light
  51.             # It's a little shiny, but not much
  52.             Material {
  53.                 diffuseColor 0.7 0.7 0.7
  54.                 shininess 0.3
  55.             }
  56.  
  57.             # And now, create the Moon
  58.             Sphere {
  59.                 radius 1    # Tiny Moon
  60.             }
  61.         }
  62.     }
  63. }
  64.  
  65.